/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.maze.display;

import java.util.ArrayList;
import javax.swing.JFrame;
import org.maze.display.swing.MainBoard;

/**
 *
 * @author Thomas
 */
public class SwingDisplay extends AbstractDisplay implements IDisplay{
    MainBoard board = new MainBoard();

    public SwingDisplay(){
        JFrame f = new JFrame("GeneticMaze");
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
        f.add(board);
        f.pack();
        f.setVisible(true);
    }

    private void displayFitest() {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    public void refresh() throws Exception {
        if(path!=null){
            board.setPath((ArrayList<Integer>)path.clone());
            board.setGeneration(generation);
            board.setAverage(average);
            board.setFitestScore(fitest.getFitnessScore());
            board.setFitestSize(fitest.getPath().size());
            board.setDiversity(diversity);
        }
        board.repaint();
    }


}
